<?php 
if(!isset($_SESSION)) 
	{ 
		session_start(); 
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<?php
$lang = $_SESSION['lang'];
if (empty($lang) || $lang == "EN") {
	include "../../value/value_en.php";
} else if($lang == "VN") {
	include "../../value/value_vn.php";
}
else {
	include "../../value/value_kr.php";
}
include '../../content-accountant/invoicetax.php';
include '../../generallibraries/funcs.php';

?>
<body>	
    	<?php 
    	if(isset($_REQUEST['type']) && isset($_REQUEST['value']) && isset($_REQUEST['vitri'])){
			$type=$_REQUEST['type'];
			$vitri=$_REQUEST['vitri'];
			$value=urldecode($_REQUEST['value']);
			if($type=="txtquantity"){
				$inobject= unserialize (serialize ($_SESSION['input_invoice'][$vitri]));
				$inobject->order_quantity=generalFunctions::numberformat_to_basicString($value);
				$inobject->tinhtien();
				$_SESSION['input_invoice'][$vitri]=$inobject;
				echo '<p style="min-width: 90px">'.number_format($inobject->order_total).'</p>';
			}else if($type=="txtrice"){
				$inobject= unserialize (serialize ($_SESSION['input_invoice'][$vitri]));
				$inobject->order_suplly_rice=generalFunctions::numberformat_to_basicString($value);
				$inobject->tinhthue();
				$inobject->tinhtien();
				$_SESSION['input_invoice'][$vitri]=$inobject;
				?>
				<input type="text" onkeypress="return enterTable(event,this.id,<?php echo count($_SESSION['input_invoice']);?>,'1')" onchange="chTax(this.value,<?=$vitri?>,'vintax');" onkeyup="chTax(this.value,<?=$vitri?>,'vintax');" id="<?echo "vointax".$vitri?>" name="ovointax[]" style="height: 24px; min-width: 90px; border: 1px solid #c4c0c9;line-height: 24px;text-align:right;padding-right:3px;font-size:12px;"	value="<?=number_format($inobject->order_tax)?>" autocomplete="off"  />
				<?php 
			}else if($type=="vintax"){
				$inobject= unserialize (serialize ($_SESSION['input_invoice'][$vitri]));
				$inobject->order_tax=generalFunctions::numberformat_to_basicString($value);
				$inobject->tinhgia();
				$inobject->tinhtien();
				$_SESSION['input_invoice'][$vitri]=$inobject;
				?>
				<input type="text" onkeypress="return enterTable(event,this.id,<?php echo count($_SESSION['input_invoice']);?>,'1')" onchange="chRice(this.value,<?=$vitri?>,'txtrice');" onkeyup="chRice(this.value,<?=$vitri?>,'txtrice');" id="<?echo "txtrice".$vitri?>" name="vrice[]" style="height: 24px; min-width: 90px;; border: 1px solid #c4c0c9;line-height: 24px;text-align:right;padding-right:3px;font-size:12px;"	value="<?=number_format($inobject->order_suplly_rice)?>" autocomplete="off"  />
				<?php 
			}
		}
    	?>
</body>
</html>
